package com.wm.string;

import java.util.Scanner;

//输入一个字符串，输入一个要查找的字符串，判断查找的字符串在字符串中出现的次数
public class SeachString {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        System.out.println("请输入字符串:");
        String str = in.next();
        System.out.println("请输入你要查找的字符:");
        String s = in.next();
        String[] array = str.split(s);
        System.out.println("\"" + s + "\"" + "在" + "\"" + str + "\"" + "中总共出现了："
                        + (array.length - 1) + "次");
    }
}
